package com.ihd.ihardware.view.lock.view;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;

import com.ihd.ihardware.R;
import com.ihd.ihardware.databinding.ActivityLockZwInputBinding;
import com.ihd.ihardware.view.lock.viewmodel.LockZWInputViewModel;

import cn.wowjoy.commonlibrary.base.BaseActivity;

public class LockZWInputActivity extends BaseActivity<ActivityLockZwInputBinding, LockZWInputViewModel> {

    @Override
    protected void init(Bundle savedInstanceState) {
        mImmersionBar.statusBarDarkFont(false).init();

        binding.mtitlebar.setLeftBack(this);
        binding.mtitlebar.setLeftImageResource(R.drawable.lock_nb_back);

        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                binding.lockStatus.setImageResource(R.drawable.lock_icon_zwfail);
                binding.hint0.setVisibility(View.VISIBLE);
                binding.hint1.setVisibility(View.VISIBLE);
                binding.retry.setVisibility(View.VISIBLE);
            }
        }, 2000);

        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                binding.lockStatus.setImageResource(R.drawable.lock_icon_zwsucc);
                binding.hint0.setVisibility(View.VISIBLE);
                binding.hint0.setText("恭喜,指纹录入成功!");
                binding.hint0.setTextColor(getResources().getColor(R.color.C_B5FF56));
                binding.hint1.setVisibility(View.GONE);
                binding.retry.setVisibility(View.GONE);
                binding.hint2.setVisibility(View.VISIBLE);
                binding.cancel.setVisibility(View.GONE);
            }
        }, 4000);

        binding.hint2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent mIntent = new Intent(LockZWInputActivity.this, LockZWManagerActivity.class);
                startActivity(mIntent);
            }
        });
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_lock_zw_input;
    }

    @Override
    protected Class getViewModelClass() {
        return LockZWInputViewModel.class;
    }
}
